package luj.groovy.excel.internal.table.create

import groovy.transform.PackageScope
import luj.groovy.excel.api.table.Table
import luj.groovy.excel.api.table.build.TableBuilder
import org.apache.poi.ss.usermodel.Sheet

@PackageScope
class BuildTableImpl implements TableBuilder {

  @Override
  Header header() {
    return _header
  }

  @Override
  TableBuilder header(@DelegatesTo(Header) Closure builder) {
    builder.setDelegate(_header)
    builder.call()
    return this
  }

  @Override
  Table build() {
    return new TableInSheetMaker(this).make()
  }

  Sheet _sheet

  BuildHeaderImpl _header
}
